import { Component, Input, OnInit, ElementRef, Renderer2, ViewChild } from '@angular/core';
import { IonicPage, NavController, NavParams, ToastController } from 'ionic-angular';
import { TopicInfo } from '../../models/quesinfo';
import { ImagePicker, ImagePickerOptions } from '@ionic-native/image-picker';
import { Media, MediaObject } from '@ionic-native/media';
import { File } from '@ionic-native/file';
import { ActionSheetController } from 'ionic-angular';
import { Camera, CameraOptions } from '@ionic-native/camera';
import { DomSanitizer } from '@angular/platform-browser';

/**
 * Generated class for the DmtPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@Component({
  selector: 'page-dmt',
  templateUrl: 'dmt.html',
})

export class DmtPage {
  @Input() topic: TopicInfo;@Input() poneSet: Array<any>;
  audioUrl;
  constructor(public navCtrl: NavController,
    public navParams: NavParams,
    public sanitizer: DomSanitizer) {
  }
  ngOnInit() {
    const content = (this.topic.dmtType === 'mp4' ? 'data:video/mp4;base64,' : 'data:audio/mpeg;base64,') + (this.topic.dmtType === 'mp4' ? this.topic.mp4 : this.topic.mp3);
    this.audioUrl = this.sanitizer.bypassSecurityTrustUrl(content);
  }
  ionViewDidLoad() {
    console.log('ionViewDidLoad DmtPage');
  }

}
